﻿using TrueSync;
using UnityEngine;

namespace HEFramework
{
    public static class MonsterSystem
    {
        [EntitySystem]
        public class MonsterAwakeSystem : AwakeSystem<Monster, int>
        {
            protected override void Awake(Monster _self, int _a)
            {
                _self.ID = _a;
                var ac = _self.AddChild<AttributeComponent, int, int>(_self.ID, 0);
                var tc = _self.AddChild<TransformComponent>();
                _self.AddChild<DeathComponent>();
                _self.AddChild<MoveComponent>();
                _self.AddChild<AlertComponent, int>(0);
                _self.AddChild<ATKComponent>();
                _self.AddChild<RecoverComponent>();
                _self.AddChild<SkillComponent>();
                _self.AddChild<MonsterAIComponent>();
                _self.AddChild<SphereCollisionComponent, FP, TSVector, TSVector>(ac.Attribute.B_RAG, tc.P, TSVector.zero);
                _self.AddChild<MonsterView>();
            }
        }
    }
}